package com.xiaoxin_project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaoxin_project.pojo.Users;
import com.xiaoxin_project.pojo.vo.FriendsVo;
import com.xiaoxin_project.pojo.vo.MyFriendsVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

public interface UserMapper extends BaseMapper<Users> {

    /**
     *展示好友请求列表
     */
    @Select("select sender.id as sendUserId,sender.username as sendUserName,sender.face_image as sendFaceImage,sender.nickname as sendNickname " +
            "from friends_request fr " +
            "join users sender " +
            "on fr.send_user_id = sender.id " +
            "where fr.accept_user_id = #{acceptUserId}")
    public List<FriendsVo> queryFriendRequestList(String acceptUserId);

    @Select("select u.id as friendUserId,u.username as friendUsername,u.face_image as friendFaceImage,u.nickname as friendNickname " +
            "from my_friends mf " +
            "join users u " +
            "on u.id = mf.my_friend_user_id " +
            "where mf.my_user_id = #{myUserId}")
    public List<MyFriendsVo> queryMyFriends(String myUserId);

}
